<script type="text/javascript"><!--//--><![CDATA[//><!--

    var grid_reload = function() {
        $('#datagrid').datagrid('reload', $('#fm_search').serializeObject());
    };
    
    $(document).ready(function() {

     // Setup Datagrid
		$('#datagrid').datagrid({  
			url:gs_path+'/'+controller+'/getdata', 
			queryParams: $('#fm_search').serializeObject(),
			height:340,
			pagination:true,
			columns:[[
				{ field : 'ck', checkbox:true, width: 40, align: 'center' },
				{ field : 'id_pembayaran', title : 'No', width : 120, sortable:true },
				{ field : 'no_pembayaran', title : 'Nomor Pembayaran', width : 200, sortable:true },
				{ field : 'tanggal_bayar', title : 'Tanggal Bayar', width : 150, sortable:true },
				{ field : 'keterangan', title : 'Keterangan', width : 250, sortable:true }
			]]
		});	
        

        // Setup Form
		$('#form_master').setupForm([
			{ name: 'tanggal', type: 'date', size: 'short'},
		]);

		// Create Dialog
		$('#dialog_container').dialog({
			closed:true,
			modal:true,
			title: 'Pilihan Berdasarkan Tanggal',
			width:400,
			height:200,
			buttons:[{
				text:'Print',
				iconCls:'print',
				handler:function(){
						
					//$('#form_master').submitForm('/'+controller+'/ajax_post', { onComplete : function(){ $('#dialog_container').dialog('close'); $('#datagrid').datagrid('reload'); }} );
				}
			},{
				text:'Close',
				iconCls:'icon-cancel',
				handler:function(){
					$('#dialog_container').dialog('close');
				}
			}]
		});

		// Set Action Button
        var buttons = [
                        // ----- >> Print Excel Button
					    { label: 'Print', icon: 'print', onclick: function() {
					        var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
								var tanggal = $('#tanggal').val();
						 		window.location = gs_path + '/pro_print_excel_new/permintaan_pembayaran/?id_pembayaran='+urlencode(oSel.id_pembayaran);
					        } 
					    }},

					    // ----- >> Print PDF Button
					     /*{ label: 'Print PDF', icon: 'print', onclick: function() {
								var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
								window.open(gs_path+'/'+controller+'/cetak/?no_pembayaran='+urlencode(oSel.no_pembayaran), 'myWin', 'height=500,width=700,status=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes');
					        } 

					    }}*/ ];

        setAction(buttons);
		
		
		$('#fm_search').focusFirst();
    });
//--><!]]></script>

    
<div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="fm_search" onsubmit="grid_reload(); return false;">
        	<table class="tb_form" style="margin-bottom:0px">
        <!-- <tr>
    		<td class="label" style="width:70px">Tanggal</td>
    		<td ><input id="tanggal" /></td>
    	</tr> -->
            <tr>
            	<td width="100">Keyword</td>
                <td><input type="text" id="keyword" name="keyword" class="textfield medium" />
                	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="grid_reload(); return false;">Search</a>
                    <a href="#" class="easyui-linkbutton" iconCls="icon-blank-file" onclick="$('#fm_search').resetForm(); return false;">Reset</a>
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<div id="datagrid" toolbar="#tb"></div>


<div id="dialog_container" style="padding:5px;width:600px;height:250px;">
	<form action="" method="post">
    <table class="tb_form" style="width:100%;" cellpadding="0" cellspacing="0">

    	<!-- <tr>
        <td class="label" style="width:70px">Tanggal</td>
        <td ><select id="bulan" name="bulan">
                <option value="Januari">Januari</option>
                <option value="Februari">Februari</option>
                <option value="Maret">Maret</option>
                <option value="April">April</option>
                <option value="Mei">Mei</option>
                <option value="Juni">Juni</option>
                <option value="Juli">Juli</option>
                <option value="Agustus">Agustus</option>
                <option value="September">September</option>
                <option value="Oktober">Oktober</option>
                <option value="November">November</option>
                <option value="Desember">Desember</option>
            </select>
            <?php
            $now = date('Y');
            $pastYear = $now - 10; 
        	echo "<select id='tahun' name='tahun' >";
        		for ($a=$pastYear;$a<=$now;$a++)
        		{
        			echo"<option value='".$a."''>".$a."</option>";	
        		}
        		 echo"</select>";
        	?>
        </td>
    </tr> -->
    </table>
	</form> 
</div>